Repository navigation
Move the tests to Pester 6 - #2089
Open
Jakub Jareš (nohwnd) wants to merge 1 commit into
Open
Jakub Jareš (nohwnd) wants to merge 1 commit into
Jakub Jareš (nohwnd) wants to merge 1 commit into
Conversation
The pipeline pinned Pester with -MaximumVersion 4.99, so the suite has been
running on Pester 4 while the test code is already Pester 5 shaped: BeforeAll,
AfterAll, tags, and Should -Be everywhere. Three things stood between it and
Pester 6.
It ... -Pending is removed. The parameter binds during discovery, so each use
takes out the whole file: 9 uses in 5 files, which cost 76 tests. Replaced with
-Skip, which is what -Pending already did, since the body never ran either way.
Set-ItResult -Pending is removed as well. The one use says
-Because "Skipping test on Windows PowerShell", so it is -Skipped.
Five assertions in PublishPSResource.Tests.ps1 used the legacy syntax,
`... | Should Be $true`, which has not worked since Pester 5. Replaced with
Should -BeTrue.
Pin the pipeline to 6.2.0.
Discovery over test, counted before and after, in separate pwsh processes:
unmodified this change
Pester 5.9.1 1138 tests, 0 err 1138 tests, 0 err
Pester 6.2.0 1062 tests, 5 err 1138 tests, 0 err
🤖
Jakub Jareš (nohwnd)
requested review from
Sydney Smith (SydneyhSmith),
Aditya Patwardhan (adityapatwardhan),
alerickson,
Anam Navied (anamnavi) and
shammu1
as code owners
December 2, 2026 18:11
There was a problem hiding this comment.
🟡 Changes recommended
The Pester 6.2.0 pin leaves the CI wrapper using unsupported Invoke-Pester parameters, causing both functional-test jobs to fail before running tests or producing result.pester.xml.
1 open issue
What changed in this PR
Updates PSResourceGet’s test suite and CI dependency pin for Pester 6.2.0.
Changes:
- Pins CI to Pester 6.2.0.
- Replaces removed pending-test options with skip equivalents.
- Modernizes five assertions inside a commented-out test block; these changes do not affect active tests.
| File | Description |
|---|---|
test/SavePSResourceTests/SavePSResourceV3.Tests.ps1 |
Replaces one pending marker with skip. |
test/SavePSResourceTests/SavePSResourceV2.Tests.ps1 |
Replaces one pending marker with skip. |
test/PublishPSResourceTests/PublishPSResource.Tests.ps1 |
Updates five inactive assertions to Should -BeTrue. |
test/InstallPSResourceTests/InstallAz.Tests.ps1 |
Replaces one pending marker with skip. |
test/FindPSResourceTests/FindPSResourceRepositorySearching.Tests.ps1 |
Replaces four pending markers with skip. |
test/FindPSResourceTests/FindPSResourceLocal.Tests.ps1 |
Replaces two pending markers with skip. |
test/FindPSResourceTests/FindPSResourceContainerRegistryServer.Tests.ps1 |
Uses skipped status for Windows PowerShell. |
.ci/test.yml |
Pins Pester installation to 6.2.0. |
Review effort: Balanced
| Write-Verbose -Verbose "Install Pester 4.X to temp module path" | ||
| Save-Module -Name "Pester" -MaximumVersion 4.99 -Path $modulePath -Force | ||
| Write-Verbose -Verbose "Install Pester 6.2.0 to temp module path" | ||
| Save-Module -Name "Pester" -RequiredVersion 6.2.0 -Path $modulePath -Force |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PR Summary
Move the test suite to Pester 6.2.0.
.ci/test.ymlpinned Pester with-MaximumVersion 4.99, so the suite has been running on Pester 4while the test code is already Pester 5 shaped:
BeforeAll,AfterAll,-tags, andShould -Beeverywhere. No assertion syntax had to change. Three things stood in the way.
It ... -Pendingis removed in Pester 6. The parameter binds during discovery, so one usetakes out the whole file, not just that test. 9 uses in 5 files, and those 5 files hold 76 tests.
Replaced with
-Skip, which is what-Pendingalready did here, since the body did not run eitherway.
Set-ItResult -Pendingis removed too. One use, and it says-Because "Skipping test on Windows PowerShell", so-Skippedis the right status.Five assertions used the legacy syntax.
$expectedNuspecContents.Contains($releaseNotes) | Should Be $truein
PublishPSResource.Tests.ps1. The dashless form has not worked since Pester 5, so these five havebeen failing for anyone who ran the suite on Pester 5 or newer. Replaced with
Should -BeTrue.PR Context
I maintain Pester. I have been moving real suites to Pester 6 to find out what the upgrade actually
costs, and this one costs the four lines above plus the pin.
I cannot run this suite end to end, since it needs the built module, local and ADO repositories and
ACR credentials. What I can measure without any of that is discovery, which is where every break in
this PR lives. Counted on the test tree with
Run.SkipRun, each version in its ownpwshprocess:The three runs matter separately. The 5.9.1 column shows the change is neutral on the version you
could move to first. The unmodified 6.2.0 row is the failure, five times
A parameter cannot be found that matches parameter name 'Pending', inFindPSResourceLocal,FindPSResourceRepositorySearching,InstallAz,SavePSResourceV2andSavePSResourceV3. The last row is the fix.The five legacy assertions are a run-phase failure, so they are not in that table. They are a
one-line change each and
Should -BeTrueis the same assertion for a[bool].Worth saying, since it decides whether you want 6.2.0 or 5.x: the classic
Should -Besyntax is notdeprecated in Pester 6. The new
Should-Beassertions are additive. Nothing in this suite neededrewriting.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerIf the pipeline run turns up anything beyond this, tell me and I will fix it here rather than leaving
it with you.
🤖